package com.yyfax.account.dao;

import com.yyfax.account.domain.AccountFrozen;
import com.yyfax.account.vo.TradeSummary;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface AccountFrozenDao {

	/**
	 * @mbggenerated
	 */
	int insert(@Param("record") AccountFrozen record, @Param("segment") String segment);

	/**
	 * 更新冻结数据
	 * 
	 * @author maojian
	 * @date 2017-09-02 09:28:24
	 * @since v1.0.0
	 * @param outTradeNo
	 * @param amount
	 * @param segment
	 * @return
	 */
	int updateByOutTradeNo(@Param("outTradeNo") String outTradeNo, @Param("amount") long amount, @Param("segment") String segment);

	/**
	 * 根据outTradeNo查询AccountFrozen
	 * 
	 * @author maojian
	 * @date 2017-09-02 09:43:05
	 * @since v1.0.0
	 * @param outTradeNo
	 * @param segment
	 * @return
	 */
	AccountFrozen queryOrderByOutTradeNo(@Param("outTradeNo") String outTradeNo, @Param("segment") String segment);

	/**
	 * 根据唯一主键查询冻结信息
	 *
	 * @author liangqm
	 * @date 2017-11-04 11:39:50
	 * @since v1.0.0
	 * @param outTradeNo
	 * @param segment
	 * @return
	 */
	AccountFrozen queryAccountFrozenByUniqueKey(@Param("tradeNo") String tradeNo, @Param("outTradeNo") String outTradeNo, @Param("segment") String segment);

	/**
	 * 根据账户号和时间统计冻结解冻订单
	 *
	 * @author yangrd
	 * @date 2017-09-30 11:39:53
	 * @since v1.0.0
	 * @param accountNo
	 * @param beginDate
	 * @param endDate
	 * @param segment
	 * @return
	 */
	TradeSummary queryFrozenSumByDate(@Param("accountNo") String accountNo, @Param("beginDate") String beginDate, @Param("endDate") String endDate,
									  @Param("segment") String segment);

	/**
	 * 根据账户号和时间批量统计冻结解冻订单
	 *
	 * @author yangrd
	 * @date 2017-09-30 11:39:53
	 * @since v1.0.0
	 * @param userIdSet
	 * @param beginDate
	 * @param endDate
	 * @param segment
	 * @return
	 */
	List<TradeSummary> queryFrozenSumBatchByDate(@Param("userIdSet") Set<String> userIdSet, @Param("beginDate") String beginDate,
												 @Param("endDate") String endDate, @Param("segment") String segment);

	/**
	 * 根据账户号和截止时间统计冻结解冻订单
	 *
	 * @author yangrd
	 * @date 2017-09-30 11:39:56
	 * @since v1.0.0
	 * @param accountNo
	 * @param endDate
	 * @param segment
	 * @return
	 */
	long queryFrozenSumUntilDate(@Param("accountNo") String accountNo, @Param("endDate") String endDate, @Param("segment") String segment);

}